home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Misc / GraphicsCode / examples / polygon_example.c < prev   
Encoding:
C/C++ Source or Header  |  1996-02-12  |  1.3 KB  |  77 lines

  1. // A Little example program to load in and display an iff file.
  2. // this requires the iff.library supplied to be installed in
  3. // your libs: drawer.
  4. // Don't know what happens if it isn't.
  5.  
  6.     #include <proto/graphics.h>     // Need this for the graphics_base.h file
  7.  
  8. // My include files
  9. // Change according to their location
  10.  
  11.     #include <custom/graphics_base.h>
  12.     #include <custom/graphics.h>
  13.  
  14.     #include <hardware/cia.h>       // Don't really need this
  15.  
  16. // The C Palette data
  17.  
  18.     #include "palette.c"
  19.  
  20. __far extern struct CIA ciaa, ciab;
  21.  
  22. VOID main()
  23. {
  24.  
  25. // A Screen store structure
  26.  
  27.     struct Screen_Store *screen = NULL;
  28.     struct MaskPlane *mask = NULL;
  29.  
  30. WORD poly[]=
  31. {
  32.     50,50,
  33.     100,50,
  34.     100,100,
  35.     50,100,
  36.     50,50,
  37. };
  38.  
  39.  
  40. // init the graphics functions
  41.  
  42.     Graphics_Init();
  43.  
  44. // Open the screen
  45.  
  46.     screen=Open_Screen(320,256,8,NULL,&myData);
  47.     mask=Init_Mask(0,0,320,256,320,256);
  48.  
  49. // Link in the mask plane
  50.  
  51.     screen->MaskPlane=mask;
  52.  
  53. // Draw the polygon
  54.  
  55.     Fill_Polygon(screen,poly,5,2);
  56.  
  57. // Wait for a mouse press
  58.  
  59.     while ((ciaa.ciapra & (1 << CIAB_GAMEPORT0))!=0)
  60.         ;
  61.  
  62. // fade out
  63.  
  64.     Fade_To_Black(screen,&myData);
  65.  
  66. // Close the screen
  67.  
  68.     Free_Mask(mask);
  69.  
  70.     Close_Screen(screen);
  71.  
  72. // Close the graphics
  73.  
  74.     Graphics_Close();
  75.  
  76. }
  77.